package c.j.a.d.a.c;

import android.content.Context;
import android.text.TextUtils;
import c.b.a.a.a;
import c.j.a.d.a.h;
import c.j.a.d.b.b.e;
import com.ss.android.socialbase.downloader.g.c;
import java.io.File;
import org.json.JSONObject;

/* compiled from: DevicePlans */
public class d {
    public static String a = "";
    public static String b = "";

    public static a a(Context context, String str, JSONObject jSONObject, c cVar) {
        String str2 = cVar.e;
        if (!(TextUtils.isEmpty(str2) || TextUtils.isEmpty(str))) {
            File file = new File(str2);
            a = a.d(new StringBuilder(), e.b, "1");
            b = a.d(new StringBuilder(), e.b, "2");
            if (str.equals("vivo1")) {
                return new g(context, cVar.m0());
            }
            if (str.equals("vivo2")) {
                return new h(context, file.getAbsolutePath());
            }
            if (str.equals(a)) {
                return new e(context, file.getAbsolutePath());
            }
            if (str.equals(b)) {
                return new f(context, file.getAbsolutePath());
            }
            if (str.equals("custom")) {
                return new c(context, file.getAbsolutePath(), jSONObject);
            }
        }
        return null;
    }

    public static boolean b(Context context, String str, JSONObject jSONObject) {
        if (!(context == null || str == null)) {
            a aVar = null;
            String l = h.l();
            if (!(TextUtils.isEmpty(l) || TextUtils.isEmpty(str))) {
                a = a.d(new StringBuilder(), e.b, "1");
                b = a.d(new StringBuilder(), e.b, "2");
                if (str.equals("vivo1")) {
                    aVar = new g(context, l);
                } else if (str.equals("vivo2")) {
                    aVar = new h(context, l);
                } else if (str.equals(a)) {
                    aVar = new e(context, l);
                } else if (str.equals(b)) {
                    aVar = new f(context, l);
                } else if (str.equals("custom")) {
                    aVar = new c(context, l, jSONObject);
                }
                if (aVar != null && aVar.a()) {
                    return true;
                }
            }
        }
        return false;
    }
}
